<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./index.js"></script>
  <script>
    console.log(1);
      const p = new MyPromise((resolve, reject) => {
        console.log(2);
        setTimeout(() => {
          console.log('4');
          resolve('成功')
        }, 300);
        //resolve('成功')
        //reject('失败')
      })

      p.then(null, (err) => {
        console.log('失败1: ', err);
      }).then(res => {
        console.log('ok: ', res);
      })


      console.log(3);
  </script>
</head>
<body>

</body>
</html>